/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Procesos;

import ClasesGenerales.Boletos;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author USER
 */
public class GenerarTKT {

    public List<Boletos> GenerarNumeroTicket(String oNumeroPax) throws Exception {

        List<Boletos> oListaBoletos = null;
        Boletos oBoletos = null;
        String[] oArrPax = null;

        try {

            oListaBoletos = new ArrayList();

            if (oNumeroPax != null) {

                oArrPax = oNumeroPax.split("/");

                if (oArrPax != null) {

                    for (int i = 0; i < oArrPax.length; i++) {

                        oBoletos = new Boletos();
                        oBoletos.setN_Pax(Integer.parseInt(oArrPax[i]));
                        oBoletos.setN_Tkt(GeneraNumero());

                        oListaBoletos.add(oBoletos);
                    }
                }

            }



        } finally {

            return oListaBoletos;
        }

    }

    public String GeneraNumero() {
        int num[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
        int oNumero = 0;
        String stringo = "";
        for (byte i = 0; i < 13; i++) {
            oNumero = (int) (Math.random() * num.length + 0);
            stringo += oNumero;
        }
        return stringo;
    }
}
